# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=plasma-desktop
pkgver=5.27.10
pkgrel=0
pkgdesc="KDE Plasma Desktop"
# armhf blocked by qt5-qtdeclarative
# ppc64le, s390x and riscv64 blocked by qt5-qtwebengine -> kaccounts-integration
arch="all !armhf !ppc64le !s390x !riscv64"
url='https://kde.org/plasma-desktop/'
license="GPL-2.0-only AND LGPL-2.1-only"
depends="
	accountsservice
	font-noto-emoji
	ibus-emoji
	kde-cli-tools
	kirigami2
	plasma-workspace
	qqc2-desktop-style5
	setxkbmap
	xdg-user-dirs
	"
makedepends="
	attica5-dev
	baloo5-dev
	eudev-dev
	extra-cmake-modules
	fontconfig-dev
	ibus-dev
	kaccounts-integration-dev
	kactivities5-dev
	kactivities-stats5-dev
	kauth5-dev
	kcmutils5-dev
	kcodecs5-dev
	kconfig5-dev
	kdbusaddons5-dev
	kdeclarative5-dev
	kdelibs4support-dev
	kdoctools5-dev
	kemoticons5-dev
	kglobalaccel5-dev
	ki18n5-dev
	kitemmodels5-dev
	knewstuff5-dev
	knotifications5-dev
	knotifyconfig5-dev
	kpeople5-dev
	kpipewire-dev
	krunner5-dev
	kwallet5-dev
	kwin-dev
	libxcursor-dev
	libxi-dev
	libxkbfile-dev
	plasma-framework5-dev
	plasma-workspace-dev
	qqc2-desktop-style5-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtsvg-dev
	qt5-qtx11extras-dev
	samurai
	signon-plugin-oauth2-dev
	xf86-input-evdev-dev
	xf86-input-libinput-dev
	xf86-input-synaptics-dev
	xkeyboard-config-dev
	"
checkdepends="
	dbus
	iso-codes
	xvfb-run
	"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/plasma-desktop.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/plasma-desktop-$pkgver.tar.xz"
subpackages="$pkgname-dbg $pkgname-doc $pkgname-lang knetattach"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	dbus-run-session -- xvfb-run ctest --test-dir build --output-on-failure -E "positionertest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

knetattach() {
	pkgdesc="Wizard which makes it easier to integrate network resources with the Plasma Desktop"
	depends="kdelibs4support"

	amove usr/bin/knetattach
	amove usr/share/applications/org.kde.knetattach.desktop
}

sha512sums="
88d0aa3d4d57aa9286d1d45c1908c5a2fcc7005cc39105085c19cd22657b72b1ea4bfef5be59d3e68fe3851acb68d1b8ac8d4d33305e22c70877d66c266b03e9  plasma-desktop-5.27.10.tar.xz
"
